home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / VU Assist Modules for MacApp / Assist Module MA 3.0 / C++ interface to VUAssist / UVUAssist.a next >
Encoding:
Text File  |  1993-09-17  |  3.5 KB  |  123 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        UVUAssist.a - MacApp 3.0 compatible version
  3. ;
  4. ;    Contains:    hook VU assistance proc for the mole to call (glue routine for Object Pascal
  5. ;                method MoleAssist)
  6. ;
  7. ;    Written by:    David Shayer
  8. ;
  9. ;    Copyright:    © 1991-92 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Version: 1.0a1
  12. ;
  13. ;    Change History (most recent first):
  14. ;
  15. ;         2/13/92    JAS        indicate 3.0 compatibility, change version
  16. ;         1/27/92    JAS          indicate 3.0b4 compatibility, change version
  17. ;         10/4/91    JAS          indicate 3.0b2 compatibility, change version
  18. ;         9/10/91    JAS        indicate 3.0b2PQR compatibility, change version
  19. ;         8/21/91    JAS        change version
  20. ;         8/13/91    JAS        change ObjectIntf for TVUAssist to include
  21. ;                            fGridItemSupport data member         
  22. ;         8/13/91    JAS        set CASE to OBJ
  23. ;         8/13/91    JAS        include ObjectIntf for TEvtHandler
  24. ;
  25.  
  26.         CASE        OBJ
  27.         INCLUDE        'ObjMacros.a'
  28.         INCLUDE        'SysEqu.a'
  29.         BLANKS        ON
  30.  
  31. ;    Historical Note:  References to the "Mole" are equivalent to references to 
  32. ;    "Agent VU".  "Agent VU" was previously called the "Mole".
  33. ;
  34. ;    FUNCTION MoleHook (Select :integer; Input :Ptr; VAR OutputSize :integer;
  35. ;            Result :integer) :OSErr; C;
  36. ;
  37. ;    This is a glue routine.  It is called by the mole, with a C interface.
  38. ;    It calls TVUAssist.MoleAssist with a Pascal interface.  It passes the
  39. ;    same parameters on, it just glues the C and Pascal interfaces together.
  40. ;
  41. ;    stack frame on entry (after LINK):
  42. ;    +-------------------+
  43. ;    |        Result        |
  44. ;    +-------------------+ <-- 18(A6)
  45. ;    |    *OutputSize        |
  46. ;    +-------------------+ <-- 14(A6)
  47. ;    |        Output        |
  48. ;    +-------------------+ <-- 10(A6)
  49. ;    |        Input        |
  50. ;    +-------------------+ <-- C(A6)
  51. ;    |        Select        |
  52. ;    +-------------------+ <-- 8(A6)
  53. ;    |    Return Address    |
  54. ;    +-------------------+ <-- 4(A6)
  55. ;    |        Old A6        |
  56. ;    +-------------------+ <-- A6
  57. ;
  58. ;    stack for call to TVUAssist.MoleAssist (at MethCall):
  59. ;    +-------------------+
  60. ;    |    Return Value    |
  61. ;    +-------------------+
  62. ;    |        Select        |
  63. ;    +-------------------+
  64. ;    |        Input        |
  65. ;    +-------------------+
  66. ;    |    *OutputSize        |
  67. ;    +-------------------+
  68. ;    |        Result        |
  69. ;    +-------------------+
  70. ;    |    Object Handle    |
  71. ;    +-------------------+ <-- A7
  72. ;
  73. ;    TVUAssist.MoleAssist will remove all parameters, leaving the return value
  74. ;    on the top of the stack.
  75. ;    The mole expects the return value in D0.  The mole will remove the parameters
  76. ;    it originally placed on the stack.
  77. ;
  78.  
  79.         Seg         'Main'
  80.  
  81. ;    Abridged object definition for TEventHandler
  82.     ObjectIntf    TEventHandler, TObject, \
  83.         (fIdleFreq,4),                \
  84.         (fLastIdle,4),                \
  85.         (fNextHandler,4)
  86.         
  87. ;    Abridged object definition for TVUASSIST
  88.     ObjectIntf    TVUASSIST, TEventHandler,    \
  89.         (FMOLEREFNUM,2),            \
  90.         (GRIDITEMSUPPORT,1),        \
  91.         METHODS,                    \
  92.         (IVUASSIST),                \
  93.         (OPENMOLEDRIVER),            \
  94.         (SUSPENDMOLE),                \
  95.         (RESUMEMOLE),                \
  96.         (SETDEBUGGERHOOK),            \
  97.         (MOLEASSIST)
  98.  
  99.  
  100. MoleHook PROC EXPORT
  101.         IMPORT        gVUAssist:DATA        ;global pointer to VUAssist
  102.         LINK        A6, #$0                ;set up stack frame
  103.         MOVE.L        A5, -(A7)            ;save a5
  104.         MOVE.L        CurrentA5, A5        ;get application's A5
  105.         CLR.W        -(A7)                ;make space for return result
  106.         MOVE.W        $A(A6), -(A7)        ;push Select (load lo word)
  107.         MOVE.L        $C(A6), -(A7)        ;push Input
  108.         MOVE.L        $10(A6), -(A7)        ;push Output
  109.         MOVE.L        $14(A6), -(A7)        ;push OutputSize
  110.         MOVE.W        $1A(A6), -(A7)        ;push Result (load lo word)
  111.         MOVE.L        gVUAssist(A5),-(A7)    ;push object handle, which will become "Self"
  112.         MethCall    MOLEASSIST,TVUASSIST;call TVUAssist.MoleAssist
  113.         MOVE.W        (A7)+, D0            ;pop return result
  114.         EXT.L        D0                    ;make return result a longword
  115.         MOVE.L        (A7)+, A5            ;restore A5
  116.         UNLK        A6                    ;tear down stack frame
  117.         RTS                                ;return
  118.         DC.B        'MOLEHOOK'            ;Macsbug name
  119.         ENDPROC
  120.         
  121.         
  122.         END
  123.